<template>
    <div class="facilitator_enterprise_list_amend">
        <div class="header">
            <div class="header_title" :class="{active: baseInfo}" @click="changeStatus('baseInfo')" >基本信息</div>
            <div class="header_title" :class="{active: contract}" @click="changeStatus('contract')">签约设置</div>
        </div>
        <div class="content">
            <!-- 基本信息 -->
            <enterprise-base v-show="baseInfo" :reset="reset" :type=2 ></enterprise-base>

            <!-- 签约设置 -->
            <enterprise-contract v-show="contract" :reset="reset" :type=2  ></enterprise-contract>
        </div>
    </div>
</template>

<script>
    import EnterpriseBase from 'components/businessManagement/child_component/enterprise_base';
    import EnterpriseContract from 'components/businessManagement/child_component/enterprise_contract';
    import EnterpriseAccount from 'components/businessManagement/child_component/enterprise_account';


export default {
    name:"FacilitatorEnterpriseListAmend",
    components: {
        EnterpriseBase,
        EnterpriseContract,
        EnterpriseAccount
    },
    data(){
          return {
              baseInfo: true,           //基本信息是否显示（默认点击查看企业时，基本信息默认展开显示）
              contract: false,          //签约设置信息是否显示
              account: false,           //账户设置是否显示
              current_path: '',         //当前路由
              reset: false,             //是否重新进来
              enterprise_id:0   
          }
    },
    computed:{
        getNavList() {
            return this.$store.getters.getNavList;
        }
    },
    mounted(){
        this.$setRouteTitle();
        this.current_path = this.$route.path;
    },
    activated(){
        console.log('activate', this.reset);
        let flag = false;
        for(let val of this.getNavList){
            if(val.path == this.current_path){
                flag = true;
            }
        }
        if(!flag){
            this.$setRouteTitle();
            this.reset = true;
        }
    },
    deactivated(){
        console.log('deactivated', this.reset);
        let flag = false;    //是否保留数据
        for(let val of this.getNavList){
            if(val.path == this.current_path){
                flag = true;
            }
        }
        if(!flag){
            this.reset = false;
        }
    },

    methods:{
        changeStatus(select){
            switch(select){
                case 'baseInfo':
                    if(!this.baseInfo){
                        this.contract = false;
                        this.baseInfo = true;
                    }   
                    break;
                case 'contract':
                    if(!this.contract){
                        this.baseInfo = false;
                        this.contract = true;
                    }   
                    break;
            }     
        }
    }
}
</script>

<style lang="less" :scope="true" >
    .facilitator_enterprise_list_amend{
        margin: 10px;
        padding:0 10px;
        font-size: 14px;
        background: #fff;

        .active{
            color: #4280f2;
            border-bottom: 2px solid #4280f2
        }

        .header{
            display: inline-block;
            margin:10px auto;
            width: 100%;
            border-bottom: 1px solid #e0e0e0;

            .header_title{
                width: 70px;
                height: 50px;
                margin: 0 10px;
                line-height: 50px;
                text-align: center;
                float: left;
                
            }
        }

        .content{
            margin: 10px;
        }

    }

</style>>